package com.funtl.screw.common.route;

import com.funtl.screw.common.route.rule.GrayRouteLoadBalancerClientConfiguration;
import com.funtl.screw.common.route.feign.GrayRouteFeignRequestInterceptor;
import feign.RequestInterceptor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * <p>Title GrayLoadBalancerAutoConfiguration</p >
 * <p>Description  </p >
 *
 * @author Lusifer
 */
@Configuration
@ConditionalOnProperty(value = "gray.rule.enabled", havingValue = "true")
@LoadBalancerClients(defaultConfiguration = GrayRouteLoadBalancerClientConfiguration.class)
public class GrayRouteLoadBalancerAutoConfiguration {

    @Bean
    public RequestInterceptor grayFeignRequestInterceptor() {
        return new GrayRouteFeignRequestInterceptor();
    }
}
